window.select=(function(){

    function clearall(){
            window.getSelection().removeAllRanges();    
    }
    
    function selectE(e){
            let selection = window.getSelection();
            let range = document.createRange();
            range.selectNode(e);
            selection.addRange(range);
    }

    function copy(text){
            var textarea = document.createElement("textarea");
            document.body.appendChild(textarea);
            textarea.value = text;
            textarea.focus();
            if (textarea.setSelectionRange)
                textarea.setSelectionRange(0, textarea.value.length);
            else       textarea.select();
           document.execCommand("copy");
           document.body.removeChild(textarea);
    }
})();

